<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="nc.lfw.core.LfwRuntimeEnvironment"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ taglib uri="http://www.ufida.com/multilang" prefix="ml" %>

<%
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	String date = sdf.format(LfwRuntimeEnvironment.getLoginDate().toDate()); 
	String corpName = LfwRuntimeEnvironment.getCorp() == null ? "" : LfwRuntimeEnvironment.getCorp().getUnitname();
	String userName = LfwRuntimeEnvironment.getUserVO().getUserName();
	pageContext.setAttribute("date", date);
	pageContext.setAttribute("corpName", corpName);
	pageContext.setAttribute("userName", userName);
	
	String langCode = LfwRuntimeEnvironment.getLangCode();
	String datasource = LfwRuntimeEnvironment.getUserDataSource();
 	String url = "/helpmain.jsp?datasource=" + datasource + "&langcode=" + langCode + "&flag=201103&filename=erm201103.html";
 %>
<table id="webbx_main_head" border="0" cellpadding="0" cellspacing="0" style="width:100%;height:100%;background:#94C6F9">
	<tr>
		<td align="left" rowspan="2" width="698px" style="background:url('${NODE_IMAGE_PATH}/top/banner.gif') no-repeat">
			<div class="logodiv">
			</div>
		</td>
		<td align="right" width="35%">
			<table>
				<td><img src="${NODE_IMAGE_PATH}/top/logout.png" id="img_lagout" onclick="showWatcher();stopAll(event);" style="cursor: hand"></td>
				<td><a href="#" target="_blank" onfocus="this.blur();" onclick="showWatcher();stopAll(event);" class="head_nav">${ml:trans('yer_log')}</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>
				<td><img src="${NODE_IMAGE_PATH}/top/logout.png" id="img_lagout" onclick="logout();" style="cursor: hand"></td>
				<td><a href="#" onclick="logout();stopAll(event);" onfocus="this.blur();" class="head_nav">${ml:trans('yer_logout')}</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>
				<td><img src="${NODE_IMAGE_PATH}/top/settings.gif" id="img_lagout" onclick="modifyConfig();" style="cursor: hand"></td>
				<td><a href="#" onclick="modifyConfig();stopAll(event);" onfocus="this.blur();" class="head_nav">${ml:trans('yer_setting')}</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>
				<td><img src="${NODE_IMAGE_PATH}/top/help.png" id="img_help" onclick="alert('帮助')" style="cursor: hand"></td>
				<td><a href="#" onclick="window.open('<%= url%>');stopAll(event);" onfocus="this.blur();" class="head_nav">${ml:trans('yer_help')}</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>
			</table>
		</td>
	</tr>
	<tr>

		<td width="20%" align="right">
			${corpName}&nbsp;&nbsp;${userName},${ml:trans('yer_hello')}&nbsp;&nbsp;${date}
			&nbsp;&nbsp;&nbsp;&nbsp;
			<%--
			<input name="quickcode" type=text width="20" onkeydown="quickcommand();"/>
			--%>
		</td>
	</tr>
</table>
<script>
	function showWatcher() {
		window.open('/lfw/core/watcher.jsp?pageId=logwatcher&userid=<%= LfwRuntimeEnvironment.getUserCode() %>', "", "width=100,height=100,location=no,status=no,menubar=no");
	}
	function quickcommand(e){
		if(!e)
			e = window.event;
		var keyCode = e.keyCode ? e.keyCode : e.charCode ? e.charCode : e.which ? e.which : void 0;	
    	if(keyCode == 13){
    		var inputValue = $("quickcode").value;
    		if(inputValue != null)
    			inputValue = inputValue.toLowerCase();
    		if(inputValue == 'out'){
				ok.key = "out";
				showConfirmDialog("当前人确实外出吗? 如外出则审批事物交由代理人处理.", ok,null);
			}else if(inputValue == 'in'){
				ok.key = "in";
				showConfirmDialog("当前人外出回来? 审批事物由本人处理,代理人不再处理.", ok,null);
			}else if(inputValue == 'people'){
				var str = getService('lfw_common_service').executeCommand('people');
				if(str != null && str != ''){
					window.people = str;
					showDialog(window.corePath + "/main/commandresult.html", "在线人", "300", "400", "commandresult", true)
				}
			}
		}
	}
	function ok(){
		if(ok.key == 'out'){
			getService('lfw_common_service').executeCommand('out');
		}else if(ok.key == 'in'){
			getService('lfw_common_service').executeCommand('in');
		}
		ok.key = null;
	}
</script>